
package biblio.dao;


import biblio.domain.Reader;
import biblio.exception.NoSuchEntityException;
import java.io.Serializable;
import java.util.List;


/**
 * Interface for persistance of Reader.
 * 
 * @author mephisto
 */
public interface ReaderDAO
{
/**
     * Persists reader given as a parameter in the database.
     *
     * @param reader the reader to set, this entity will be persited in the database
     */
    void create(Reader reader);

    /**
     * Returns found hire indentified by id in the database or throws
     * NoSuchEntityException if such books does not exist.
     *
     * @param id the id to set
     * @return Reader which is identfied by id
     * @throws NoSuchEntityException if no Reader is
     *         associated with this id
     */
    Reader getById(Integer id) throws NoSuchEntityException;

    /**
     * Returns found readers indentified by lastName in the database or throws
     * NoSuchEntityException if such readers does not exist.
     *
     * @param lastName the lastName to set
     * @return Reader which is identfied by lastName
     * @throws NoSuchEntityException if no Reader is
     *         associated with this lastName
     */
    List<Reader> find(Serializable lastName) throws NoSuchEntityException;

    /**
     * Returns the list of all readers stored in the database. List is empty
     * when no entity is stored in the database.
     *
     * @return the list of all readers stored in the database
     */
    List<Reader> selectAll();

    /**
     * Updates found reader in the database or throws
     * NoSuchEntityException if such reader does not exist.
     *
     * @param reader to set the reader which will be updated
     * @throws NoSuchUserException if no User is associated with this id
     */
    void update(Reader reader) throws NoSuchEntityException;

    /**
     * Deletes reader from the database if only exists.
     *
     * @param reader to set the reader which will be deleted
     */
    void delete(Reader reader);
}
